package com.codedef.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.codedef.entity.Classroom;
import com.codedef.mapper.ClassroomMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassroomService {

    @Autowired
    ClassroomMapper classroomMapper;

    public List<Classroom> getAllClassroom() {
        return classroomMapper.selectList(null);
    }

    public List<Classroom> getAllClassroomListByFloorId(Integer floorId) {
        return classroomMapper.selectList(new QueryWrapper<Classroom>().eq("floor_id", floorId));
    }


    /**
     * 通过教室的Id获取教室的Abbreviation
     * @param classroomId 教室的Id
     * @return Abbreviation
     */
    public String getAbbreviationById(Integer classroomId) {
        return classroomMapper.selectAbbreviationById(classroomId);
    }


}
